class GtpChar(object):
    GTP_CHAR_TYPE_DICT = {"NORMAL" :  0, 'SLASH' : 1, 'END' : 2, 'ILLEGAL' : 3}
    GTP_CHAR_TYPE_TABLE = None 

    def __init__(self):
        if GtpChar.GTP_CHAR_TYPE_TABLE  is None:
            GtpChar.GTP_CHAR_TYPE_TABLE = [0 for x in range(1<<8)]

        GtpChar.GTP_CHAR_TYPE_TABLE[ord('\\')] = GtpChar.GTP_CHAR_TYPE_DICT['SLASH']
        GtpChar.GTP_CHAR_TYPE_TABLE[ord(',')]  = GtpChar.GTP_CHAR_TYPE_DICT['END']
        GtpChar.GTP_CHAR_TYPE_TABLE[ord(']')]  = GtpChar.GTP_CHAR_TYPE_DICT['END']
        GtpChar.GTP_CHAR_TYPE_TABLE[ord('}')]  = GtpChar.GTP_CHAR_TYPE_DICT['END']
        GtpChar.GTP_CHAR_TYPE_TABLE[ord('=')]  = GtpChar.GTP_CHAR_TYPE_DICT['ILLEGAL']
        GtpChar.GTP_CHAR_TYPE_TABLE[ord('[')]  = GtpChar.GTP_CHAR_TYPE_DICT['ILLEGAL']
        GtpChar.GTP_CHAR_TYPE_TABLE[ord('{')]  = GtpChar.GTP_CHAR_TYPE_DICT['ILLEGAL']

    def get_char_type(self, char):
        return GtpChar.GTP_CHAR_TYPE_TABLE[ord(char)]

    def is_slash_char(self, char):
        return self.get_char_type(char) == GtpChar.GTP_CHAR_TYPE_DICT['SLASH']
         
    def is_string_end_char(self, char):
        return self.get_char_type(char) == GtpChar.GTP_CHAR_TYPE_DICT['END']

    def is_string_illegal_char(self, char):
        return self.get_char_type(char) == GtpChar.GTP_CHAR_TYPE_DICT['ILLEGAL']

    def is_escape_char(self, char):
        return self.get_char_type(char) != GtpChar.GTP_CHAR_TYPE_DICT['NORMAL']

    def is_not_escape_char(self, char):
        return self.get_char_type(char) == GtpChar.GTP_CHAR_TYPE_DICT['NORMAL']

if  __name__ == '__main__':
    gtp_char  = GtpChar()

    print('3-1 : ', gtp_char.is_string_illegal_char(']'))
    print('3-2 : ', gtp_char.is_string_illegal_char('{'))
    print('4 : ', gtp_char.is_escape_char(','))
    print('5 : ', gtp_char.is_not_escape_char(','))
